home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ptv3n5.zip / MAKERAW.C < prev    next >
Text File  |  1992-08-18  |  677b  |  22 lines

  1. #include <stdio.h>
  2. #include <io.h>
  3. void main (void) {
  4.  unsigned DevAttr;
  5.  if (isatty (fileno (stdprn))) {        // do this on character
  6.                     // devices only
  7.    // Get current device attribute word
  8.    DevAttr = ioctl (fileno (stdprn), 0);
  9.  
  10.    // Now set bit 5 (raw mode) in device attribute word
  11.    // High byte of attribute word sent must be 0.
  12.    ioctl (fileno (stdprn), 1, (DevAttr | 0x20) & 0xff);
  13.  
  14.    // The device accessed by stdprn is now in "raw" mode.
  15.   }
  16.  
  17.   // Before closing stdprn or before exiting the program,
  18.   // be sure to change it back to "cooked" mode.
  19.   if (isatty (fileno (stdprn)))
  20.     ioctl (fileno (stdprn), 1, DevAttr & 0xff);
  21. }
  22.